# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day112_pyqt5_gridlayout
   Description :
   Author :       fuml
   date：          2019/9/20
-------------------------------------------------
   Change Activity:
                   2019/9/20:
                   In this example, we create a bit
more complicated window layout using
the QGridLayout manager.
-------------------------------------------------
"""

import  sys
from PyQt5.QtWidgets import (QWidget,QApplication,QLabel,QPushButton,
                             QVBoxLayout,QHBoxLayout,QGridLayout,QLineEdit,QTextEdit)
from PyQt5.QtGui import QIcon


class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        btn =QPushButton('testBtn')
        title = QLabel('Title')
        author=QLabel('Author')
        review=QLabel('Review')

        titleEdit=QLineEdit()
        authorEdit=QLineEdit()
        reviewEdit=QTextEdit()

        gridlayout = QGridLayout()
        gridlayout.setSpacing(10)


        #gridlayout.addWidget(btn,0,0)
        '''
        gridlayout.addWidget(title,0,0)
        gridlayout.addWidget(titleEdit,0,1)

        gridlayout.addWidget(author,1,0)
        gridlayout.addWidget(authorEdit,1,1)

        gridlayout.addWidget(review,2,0)
        gridlayout.addWidget(reviewEdit,2,1,5,1)
        '''

        gridlayout.addWidget(title, 1, 0)
        gridlayout.addWidget(titleEdit, 1, 1)

        gridlayout.addWidget(author, 2, 0)
        gridlayout.addWidget(authorEdit, 2, 1)

        gridlayout.addWidget(review, 3, 0)
        gridlayout.addWidget(reviewEdit, 3, 1, 5, 1 )

        self.setLayout(gridlayout)

        #set gemotry
        self.setGeometry(300,300,350,300)
        self.setWindowTitle('Review')
        #self.setWindowIcon(QIcon('web.png'))
        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex=Example()
    sys.exit(app.exec_())
